package com.ww.springboot.boot.test;

import cn.hutool.core.lang.func.Func;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 描述：
 *
 * @author wanwei
 * @since 2021-06-30 10:11
 */
public class RetryTest1 {

    public static void main(String[] args) throws UnsupportedEncodingException {
        String ids = "1521672275351908353";

        List<String> typeList = new ArrayList<>();
        typeList.add("callBack_trackNo_queue");
        typeList.add("callBack_label_queue");

        for(String type :typeList){
            List<String> list = Arrays.asList(ids.split(","));
            List<ForecastLogDTO> dtos = new ArrayList<>();
            for (String id : list) {
                if(dtos.size()>15){
                    String mag = "retry-" + JSONUtil.toJsonStr(dtos);
                    System.out.println(URLEncoder.encode(mag, "utf-8"));
                    dtos = new ArrayList<>();
                }
                ForecastLogDTO forecastLogDTO = new ForecastLogDTO();
                forecastLogDTO.setBizType(1);
                forecastLogDTO.setConsumerQueue(type);
                forecastLogDTO.setMqMessage("{\"id\":" + id + "}");
                dtos.add(forecastLogDTO);
            }
            String mag = "retry-" + JSONUtil.toJsonStr(dtos);
            System.out.println(URLEncoder.encode(mag, "utf-8"));
        }

//        String str = "update otms_order set `status` = 50  where platform_code = \"LZ\" and status = 60 and create_time > \"2021-04-30\" and create_time < \"2021-06-01\" and delivery_time is null\n";
//
//        System.out.println(URLEncoder.encode(str, "utf-8"));

    }
}
